<!doctype html>
<html>
<meta charset="iso-8859-1">
<head>
<style>
body,td,th{
    font-family:sans-serif;
    font-size:12px;
}
td {
    border-style:solid;
    border-width: 0px 0px 1px 0px;
    border-color: #000;
    padding:3px;
}

th {
    border-style:solid;
    border-width: 1px;
    border-color: #000;
    background-color: #61D7A4;
    padding: 4px;
}

span{font-size:15px;
    margin-left:10px;}
a.sort_link{
    margin-left:10px;
    font-size: 15px;
    text-decoration:none;
}

</style>

<script type="text/javascript" src="../src/brython_builtins.js"></script>
<script type="text/javascript" src="../src/version_info.js"></script>
<script type="text/javascript" src="../src/py2js.js"></script>
<script type="text/javascript" src="../src/py_object.js"></script>
<script type="text/javascript" src="../src/py_type.js"></script>
<script type="text/javascript" src="../src/py_utils.js"></script>
<script type="text/javascript" src="../src/py_sort.js"></script>
<script type="text/javascript" src="../src/py_builtin_functions.js"></script>
<script type="text/javascript" src="../src/py_exceptions.js"></script>
<script type="text/javascript" src="../src/py_range_slice.js"></script>
<script type="text/javascript" src="../src/py_bytes.js"></script>
<script type="text/javascript" src="../src/py_set.js"></script>
<script type="text/javascript" src="../src/js_objects.js"></script>
<script type="text/javascript" src="../src/stdlib_paths.js"></script>
<script type="text/javascript" src="../src/py_import.js"></script>
<script type="text/javascript" src="../src/unicode.min.js"></script>
<script type="text/javascript" src="../src/py_string.js"></script>
<script type="text/javascript" src="../src/py_int.js"></script>
<script type="text/javascript" src="../src/py_long_int.js"></script>
<script type="text/javascript" src="../src/py_float.js"></script>
<script type="text/javascript" src="../src/py_complex.js"></script>
<script type="text/javascript" src="../src/py_dict.js"></script>
<script type="text/javascript" src="../src/py_list.js"></script>
<script type="text/javascript" src="../src/py_generator.js"></script>
<script type="text/javascript" src="../src/py_dom.js"></script>

<script type="text/javascript" src="../src/builtin_modules.js"></script>
<script type="text/javascript" src="../src/py_import_hooks.js"></script>
<script type="text/javascript" src="../src/async.js"></script>

</head>
<body onLoad="brython(1)">
<div id="test">
</div>

<canvas id="test_canvas" width="400">
</canvas>
<script type="text/python">
from browser import document, html

test = document["test"]

try:
    test.top
    raise Exception("should have raised AttributeError")
except AttributeError:
    pass

test.top = 100
assert test.top == 100
assert test.style.top == "100px"

canvas = document["test_canvas"]
assert canvas.width == 400
canvas.height = 276
assert canvas.height == 276

# issue 758
class upgraded:

  def sty(self, _style):
    self.style=_style
    return self


class uSPAN(upgraded, html.SPAN):
  pass

span = uSPAN('hi').sty({'background':'red'})
document <= span

assert span.style.backgroundColor == "red", span.style.backgroundColor

# selection
assert len(document.get(selector="#test")) == 1
assert len(document.select("#test")) == 1

# issue 984
s = html.SVG(height=100)
assert isinstance(s.height, int)

print("all tests ok")

</script>
</body>
</html>
